package org.kernely.ui;



import org.kernely.ui.mvp.IKernelyView;

import com.vaadin.ui.Component;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Layout;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.MenuBar.MenuItem;

/**
 * The most high-level View.
 */
public class MainApplicationView extends VerticalLayout implements IKernelyView{

	/**
	 * The Serial Version ID
	 */
	private static final long serialVersionUID = -4196673676748985219L;
	
	private Layout centerLayout;
	private GridLayout menuBarLayout;
	
	private MenuBar logoutMenu;
	private MenuBar applicationsMenu;
	private MenuBar homeMenu;
	private MenuBar profileMenu;
	private MenuItem applications;
	private MenuItem userMenuItem;
	
	/**
	 * MainApplicationView's constructor
	 */
	public MainApplicationView() {
		logoutMenu = new MenuBar();
		applicationsMenu = new MenuBar();
		applicationsMenu.setImmediate(true);
		homeMenu = new MenuBar();
		profileMenu = new MenuBar();
		menuBarLayout = new GridLayout(15,1);
		this.addComponent(menuBarLayout);
		
		this.menuBarLayout.addComponent(homeMenu,0,0);
		this.menuBarLayout.addComponent(applicationsMenu,1,0,11,0);
		this.menuBarLayout.addComponent(profileMenu, 12,0,13,0);
		this.menuBarLayout.addComponent(logoutMenu,14,0);
		this.setWidth(100, UNITS_PERCENTAGE);
		this.setHeight(100, UNITS_PERCENTAGE);

		menuBarLayout.setWidth(100,UNITS_PERCENTAGE);
		logoutMenu.setWidth(100,UNITS_PERCENTAGE);
		homeMenu.setWidth(100,UNITS_PERCENTAGE);
		applicationsMenu.setWidth(100,UNITS_PERCENTAGE);
		profileMenu.setWidth(100,UNITS_PERCENTAGE);

		this.setImmediate(true);
	}
	
	/**
	 * @see org.kernely.core.service.IKernelyView
	 */
	@Override
	public final Component getComponent() {
		return this;
	}

	/**
	 * Gets the logoutMenu
	 * @return the logoutMenu
	 */
	public final MenuBar getLogoutMenu() {
		return logoutMenu;
	}

	/**
	 * Gets the applicationsMenu
	 * @return the applicationsMenu
	 */
	public final MenuBar getApplicationsMenu() {
		return applicationsMenu;
	}

	/**
	 * Gets the homeMenu
	 * @return the homeMenu
	 */
	public final MenuBar getHomeMenu() {
		return homeMenu;
	}

	/**
	 * Gets the profileMenu
	 * @return the profileMenu
	 */
	public final MenuBar getProfileMenu() {
		return profileMenu;
	}

	/**
	 * Gets the applications
	 * @return the applications
	 */
	public final MenuItem getApplications() {
		return applications;
	}

	
	

	/**
	 * Sets the applications
	 * @param applications the applications to set
	 */
	public final void setApplications(MenuItem applications) {
		this.applications = applications;
	}

	/**
	 * Gets the menu item of the user, displayed when the user click on his name.
	 * @return the userMenuItem
	 */
	public final MenuItem getUserMenuItem() {
		return userMenuItem;
	}

	/**
	 * Sets the userMenuItem
	 * @param userMenuItem the userMenuItem to set
	 */
	public final void setChangeProfileItem(MenuItem userMenuItem) {
		this.userMenuItem = userMenuItem;
	}

	/**
	 * Gets the centerLayout
	 * @return the centerLayout
	 */
	public final Layout getCenterLayout() {
		return centerLayout;
	}

	/**
	 * Sets the centerLayout
	 * @param centerLayout the centerLayout to set
	 */
	public final void setCenterLayout(Layout centerLayout) {
		this.centerLayout = centerLayout;
	}
	
	
}
